<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>NFC Brands demo</title>

<link rel="stylesheet" href="jquery.mobile-1.0.1.min.css" />

<script src="jquery-1.7.1.min.js"></script>

<script src="jquery.mobile-1.0.1.min.js"></script>


<!-- Add fancyBox -->
<script type="text/javascript" src="jquery.fancybox.pack.js"></script>


<script type="text/javascript" charset="utf-8" src="phonegap-1.4.1.js"></script>

<script type="text/javascript" charset="utf-8" src="phonegap-nfc.js"></script>

<script type="text/javascript" src="jquery.mobile.simpledialog.min.js"></script>

<!--<script type="text/javascript" charset="utf-8" src="phonegap-nfc.js"></script>-->

<script type="text/javascript">
    
	function parseTag(nfcEvent) {


		var records = nfcEvent.tag.ndefMessage;

		for ( var i = 0; i < records.length; i++) {
			var record = records[i];
			var idtag = new String(nfc.bytesToString(record.payload) + "pic");
			//alert(idtag);

			var smallpic = document.getElementById(idtag);
			//alert(x);

			$("#"+ nfc.bytesToString(record.payload)).simpledialog({
		        'mode' : 'blank',
		        'prompt': false,
		        'forceInput': false,
		        'useModal':true,
		        'fullHTML' : smallpic         
		        	//'<img src = "nike_Small.png" />'
		    });

		}

	}

	window.addEventListener('load', function() {

		document.addEventListener('deviceready', function() {

			$(".nfcIcon").click(function() {

				window.plugins.PluginWriter.write({

					input : $(this).attr('id')

				});

			});

		}, false);

	}, false);
</script>

<script type="text/javascript" charset="utf-8" src="writerJS.js"></script>
<!-- 
<script type="text/javascript" charset="utf-8" src="reader.js"></script>
-->
</head>

<body>



	<div data-role="page" id="home">

		<div data-role="header">

			<h1>NFC Tagging Demo</h1>

		</div>


		<div data-role="content">

			<div class="ui-grid-a">

				<div id="nike" class="ui-block-a nfcIcon">

					<img id = "nikepic" src="nike_Small.png" />

				</div>

				<div id="starbucks" class="ui-block-b nfcIcon">

					<img id = "starbuckspic" src="starbucks_Small.png" />

				</div>

				<div id="android" class="ui-block-a nfcIcon">

					<img id = "androidpic" src="android_Small.png" />

				</div>

				<div id="mercedes" class="ui-block-b nfcIcon">

					<img id = "mercedespic" src="mercedes_Small.png" />

				</div>

			</div>

		</div>


		<div data-role="footer" data-position="fixed">

			<h1>Touch an icon to brand a tag</h1>

		</div>


	</div>

</body>

</html>
